﻿
var urlPattern = /^https:\/\/www.facebook.com\/\S+\/allactivity/i;

var checkForValidUrl = function (tabId, changeInfo, tab) {

    if (urlPattern.test(tab.url)){
        chrome.pageAction.show(tabId);
    }
};

var start = function (tab) {
    chrome.tabs.sendMessage(tab.id, {"start": urlPattern.test(tab.url) }, function (response) {
        console.log(response.farewell);
    });
};

chrome.tabs.onUpdated.addListener(checkForValidUrl);
chrome.pageAction.onClicked.addListener(start);